import Vue from "vue";

const state = {
  headerItems: [],
  manageItems: []
};

const mutations = {
  updateHeaderAndMangageItems(state, payload) {
    state.headerItems = payload.data.headerItems;
    state.manageItems = payload.data.manageItems;
  }
};

const actions = {
  queryAuthList(context) {
    Vue.axios
      .post("/onemap/queryAuthList", {
        name: sessionStorage.getItem("name")
      })
      .then(res => {
        context.commit("updateHeaderAndMangageItems", res.data);
      });
  }
};
export default {
  namespaced: true,
  state,
  mutations,
  actions
};
